package com.android.support.lib.universal.general;

import java.io.File;

import com.android.support.lib.universal.base.BaseApplication;
import com.android.support.lib.universal.util.UtilCache;
import com.android.support.lib.universal.util.Utilsd;
import com.android.support.lib.universal.util.UtilUniversal;
import com.nostra13.universalimageloader.utils.StorageUtils;

public class GeneralCache {
	private static String pack="cn.gamehot.mobile";

	/**
	 * 清除所有缓存
	 */
	public static void clear() {
		UtilCache.get(getCacleData()).clear();// json數據
		UtilUniversal.getInstance().clear();// 圖片
	}
	
	/**
	 * 缓存位置，手机内部存储卡 json数据
	 */
	public static File getCacleData() {
		File cacheDir = StorageUtils.getOwnCacheDirectory(
				BaseApplication.getInstance(), pack+"/Cache/data");
		return cacheDir;
	}

	/**
	 * 缓存位置，手机内部存储卡 图片
	 */
	public static File getCacleImg() {
		File cacheDir = StorageUtils.getOwnCacheDirectory(
				BaseApplication.getInstance(), pack+"/Cache/img");
		return cacheDir;
	}

	/**
	 * 缓存位置，手机内部存储卡 apk安装包
	 */
	public static File getCacleApp() {
		File cacheDir = StorageUtils.getOwnCacheDirectory(
				BaseApplication.getInstance(), pack+"/Cache/app");
		return cacheDir;
	}
	/**
	 * 返回apk文件下载位置
	 * @return
	 */
	public static String getLoadPath(){
		return new Utilsd().getPath(pack+"/Cache/app");
	}
}
